{# SPDX-License-Identifier: Apache-2.0 -#}

{% extends "admin/base.html" %}

{% block title %}Sponsors{% endblock %}

{% block breadcrumb %}
  <li class="breadcrumb-item active">Sponsors</li>
{% endblock %}

{% block content %}

<div class="card card-primary card-outline">
  {% if request.has_permission(Permissions.AdminSponsorsWrite) %}
  <div class="card-header">
    <a class="btn btn-primary" href="{{ request.route_path('admin.sponsor.create') }}"><i class="fa fa-plus"></i> Create Sponsor</a>
  </div>
  {% endif %}
  <div class="card-body table-responsive p-0">
    <table class="table table-hover table-striped">
      <thead>
      <tr>
        <th>Active?</th>
        <th>Name</th>
        <th>Visibility</th>
      </tr>
      </thead>

      <tbody>
      {% for sponsor in sponsors %}
      <tr>
        <td><i class="fa {% if sponsor.is_active %}fa-check text-green{% else %}fa-times text-red{% endif %}"></i></td>
        <td>
          <a href="{{ request.route_path('admin.sponsor.edit', sponsor_id=sponsor.id) }}">{{ sponsor.name }}</a>
        </td>
        <td>{{ sponsor.visibility }}</td>
      </tr>
      {% endfor %}
      </tbody>
    </table>

  </div>
</div>
{% endblock content %}
